package cc.test.controller;

import cc.test.entity.User;
import cc.test.service.UserService;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {

  @Resource
  private UserService userService;

  @GetMapping("/users")
  public List<User> test1() {
    return userService.getAll();
  }


  @GetMapping(value = "/users/{id}")
  public User get(@PathVariable int id) {
    return userService.get(id);
  }


  @PostMapping(value = "/users")
  public String insert() {
    return "fail";
  }

}
